package experiment10;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class No_6 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        Circle circle1=new Circle();
        Circle circle2=new Circle();
        circle1.setCenterX(Math.random()*180);
        circle1.setCenterY(Math.random()*180);
        circle2.setCenterX(Math.random()*180);
        circle2.setCenterY(Math.random()*180);
        circle1.setRadius(5);
        circle2.setRadius(5);

        double d=Math.pow((Math.pow(circle1.getCenterX()-circle2.getCenterX(),2))+
                (Math.pow(circle1.getCenterY()-circle2.getCenterY(),2)),0.5);
        Line line=new Line(circle1.getCenterX(),circle1.getCenterY(),circle2.getCenterX(),circle2.getCenterY());
        Text text=new Text((circle1.getCenterX()+circle2.getCenterX())/2, (circle1.getCenterY()+circle2.getCenterY())/2,d+"");

        Pane pane=new Pane();
        pane.getChildren().addAll(circle1,circle2,line,text);




        primaryStage.setTitle("random circle");
        primaryStage.setScene(new Scene(pane,200,200));
        primaryStage.show();
    }
}
